package com.banmao.algorithm.No201To300.No226;

public class Solution2 {

    public TreeNode invertTree(TreeNode root) {

        recrusive(root);

        return root;
    }

    private void recrusive(TreeNode root) {

        // 遍历节点
        if(root == null) {
            return;
        }

        recrusive(root.left);
        recrusive(root.right);

        TreeNode left = root.left;
        root.left = root.right;
        root.right = left;

    }

}
